<?php


namespace app\api\controller;


use app\api\modle\Member;
use think\view\driver\php;

class Base
{

    public function hello()
    {
        $mobile =input('get.mobile');
        $password = input('get.password');
        $nickname = input('get.$nickname');

        if (empty($mobile) || empty($password) || empty($nickname)){
            echo '请填写完整的信息';
            die();
        }
        if (strlen($mobile) != 11){
            echo  '手机号码不合法';
            die();
        }
        if (strlen($password) <= 6){
            echo '密码长度不能小于6位';
            die();
        }
        $memberModel = new Member();
        $data = $memberModel->where('member', '=', $mobile)->find();
        if (!empty($data)){echo '该手机号码已被注册';die();}

        $data = array();
        $data['member_mobile']=$mobile;
        $data['member_password']=md5($password);
        $data['member_nickname']=$nickname;
        $data['member_time']=time();
        $memberModel->insert($data);
        echo '注册成功';
    }

}